package com.cg.controller;

import com.cg.client.AppClient;
import com.cg.dto.*;
import com.cg.vo.LoginPatientUserVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @ClassName PatientUserController
 * @Description TODO
 * @Author CG
 * @Date 2023/12/31 14:40
 **/
@RestController
@RequestMapping("/patientUser")
public class PatientUserController {

    @Resource
    private AppClient appClient;

    /**
     * 获取注册需要的手机验证码
     */
    @PostMapping("/getCode")
    public Result getCode(@RequestBody PhoneDto phoneDto){
        return appClient.getCode(phoneDto);
    }


    /**
     * 注册用户
     */
    @PostMapping("/createPatientUser")
    public Result createPatientUser(@RequestBody RegisterPatientUserDto registerPatientUserDto){
        return appClient.createPatientUser(registerPatientUserDto);
    }


    /**
     * 获取登录的手机验证码
     */
    @PostMapping("/getLoginCode")
    public Result getLoginCode(@RequestParam("phone") String phone){
        return appClient.getLoginCode(phone);
    }


    /**
     * 患者登录
     */
    @PostMapping("/loginPatientUser")
    public Result<LoginPatientUserVo> loginPatientUser(@RequestBody LoginPatientUserDto loginPatientUserDto){
        return appClient.loginPatientUser(loginPatientUserDto);
    }


    /**
     * 修改密码
     */
    @PostMapping("/updatePassword")
    public Result updatePassword(UpdatePasswordDto updatePasswordDto){
        return appClient.updatePassword(updatePasswordDto);
    }
}
